# -*- coding: utf-8 -*-
# @Time : 2018/12/26 9:15
# @Author : Administrator
# @File : soaptest.py
# @Project : python_demo
# @title :
# from suds.client import Client
# url='http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl'
# mobileCode='18030795881'
# userID=''
# Client=Client(url=url)
# res=Client.service.getMobileCodeInfo(mobileCode)
# print(res)


from suds.client import Client
client=Client(url="http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl")#实例化一个client

resp=client.service.getMobileCodeInfo("18030795881","")#请求接口
print(resp)

# c=Client("http://fy.webxml.com.cn/webservices/EnglishChinese.asmx?wsdl")
# res=c.service.Translator("hello")
# print(res)


import requests
# url='http://ws.webxml.com.cn/WebServices/WeatherWS.asmx/getWeather'
# data={'theCityCode':'成都','theUserID':''}
# res=requests.post(url=url,data=data)
# print(res.text)
# if '成都' in res.text:
#     print('ok')
# else:
#     print('no')

# from suds.xsd.doctor import ImportDoctor, Import
#
# imp = Import('http://www.w3.org/2001/XMLSchema',
#                 location='http://www.w3.org/2001/XMLSchema.xsd')
# imp.filter.add('http://WebXml.com.cn/')
# doctor = ImportDoctor(imp)
#
# client = Client('http://fy.webxml.com.cn/webservices/EnglishChinese.asmx?wsdl', doctor=doctor)
# # print client
# # print (client.service.getWeatherbyCityName(u'成都'))
# r=client.service.Translator("意思")
# print(r)


res=requests.post(url="http://ws.webxml.com.cn/WebServices/WeatherWS.asmx/getWeather",
              data={'theCityCode':'成都','theUserID':''})
print(res.text)
assert "成都" in res.text